<div navbar ng-init="currentItem='log'"></div>
<div ng-show="!loaded"><div loading></div></div>

<div id="main" ng-show="loaded" style="display:none">
	
	<div class="tabbable" id="list"  text-align="left">

		<div style="margin-top:15px;height:30px;">
            <ul class="nav nav-tabs">
            			<li ng-class="'active' | iftrue:activeTabName=='serverlog'"><a href="#serverlog" ng-click="load('serverlog')" data-toggle="tab">服务日志</a></li>
            			<li ng-class="'active' | iftrue:activeTabName=='attandposlog'"><a href="#attandposlog" ng-click="load('attandposlog')" data-toggle="tab">失败日志</a></li>
            		</ul>
			<!--
			<div class="pull-right">
				<button class="btn btn-small" data-toggle="button" ng-click="togglehidden()"><i class="icon-check"></i> 显示隐藏文件和目录</button>
			</div>-->
		</div>
		<div class="tab-content">
		<div class="tab-pane" ng-class="'active' | iftrue:activeTabName=='serverlog'" ng-init="load('serverlog')" id="serverlog">
			<table class="table table-hover" style="margin-top:15px;">
				<thead>
					<tr>
						<th style="width:10px"><input type="checkbox" ng-model="selectall"></th>
						<th style="width:200px">名称</th>
						<th style="width:50px">大小</th>
						<th style="width:140px">修改时间</th>
						<th style="width:70px">下载</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-class="'warning'|iftrue:clipboard.srcpath==curpath&&clipboard.items[item.name]" ng-repeat="item in items">
						<td><input type="checkbox" ng-model="selects[item.name]"></td>
						<td style="width:200px">
							<i class="icon-folder-open" title="文件夹" ng-show="item.isdir"></i>
							<i class="icon-file" title="文件" ng-show="item.isreg"></i>
							<i class="icon-asterisk" title="链接" ng-show="item.islnk&&(item.link_isdir||item.link_isreg)"></i>
							<i class="icon-ban-circle" title="未知" ng-show="!item.isdir&&!item.isreg&&(!item.islnk||(item.islnk&&!item.link_isdir&&!item.link_isreg))"></i>
							<a class="black" ng-click="listdir(curpath+'/'+item.name)" ng-show="item.isdir||(item.islnk&&item.link_isdir)">{{item.name}}</a>
							<a class="black" ng-click="editfile(item.name)" ng-show="item.isreg||(item.islnk&&!item.link_isdir)">{{item.name}}</a>
							<span class="text-info" ng-show="item.islnk&&!item.link_broken">-> {{item.linkto}}</span>
							<span class="text-error" ng-show="item.islnk&&item.link_broken">-> {{item.linkto}} (错误链接)</span>
						</td>
						<td style="width:50px">{{item.size}}</td>
						<td style="width:140px">{{item.mtime}}</td>
						
						<td style="width:70px">
						<!--  	<a class="btn btn-mini" ng-click="logload(item.name)" target="_blank" ng-show="item.isreg||(item.islnk&&item.link_isreg)" title="下载"><i class="icon-download-alt"></i></button> -->
							<a class="btn btn-mini" href="/{{curpath+'/'+item.name}}" target="_blank" ng-show="item.isreg||(item.islnk&&item.link_isreg)" title="下载"><i class="icon-download-alt"></i></button>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="tab-pane" ng-class="'active' | iftrue:activeTabName=='attandposlog'" id="attandposlog">
			<table class="table table-hover" style="margin-top:15px;">
				<thead>
					<tr>
						<th style="width:10px"><input type="checkbox" ng-model="selectall"></th>
						<th style="width:200px">名称</th>
						<th style="width:50px">大小</th>
						<th style="width:140px">修改时间</th>
						<th style="width:70px">下载</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-class="'warning'|iftrue:clipboard.srcpath==curpath&&clipboard.items[item.name]" ng-repeat="item in items">
						<td><input type="checkbox" ng-model="selects[item.name]"></td>
						<td style="width:200px">
							<i class="icon-folder-open" title="文件夹" ng-show="item.isdir"></i>
							<i class="icon-file" title="文件" ng-show="item.isreg"></i>
							<i class="icon-asterisk" title="链接" ng-show="item.islnk&&(item.link_isdir||item.link_isreg)"></i>
							<i class="icon-ban-circle" title="未知" ng-show="!item.isdir&&!item.isreg&&(!item.islnk||(item.islnk&&!item.link_isdir&&!item.link_isreg))"></i>
							<a class="black" ng-click="listdir(curpath+'/'+item.name)" ng-show="item.isdir||(item.islnk&&item.link_isdir)">{{item.name}}</a>
							<a class="black" ng-click="editfile(item.name)" ng-show="item.isreg||(item.islnk&&!item.link_isdir)">{{item.name}}</a>
							<span class="text-info" ng-show="item.islnk&&!item.link_broken">-> {{item.linkto}}</span>
							<span class="text-error" ng-show="item.islnk&&item.link_broken">-> {{item.linkto}} (错误链接)</span>
						</td>
						<td style="width:50px">{{item.size}}</td>
						<td style="width:140px">{{item.mtime}}</td>
											
						<td style="width:70px">
						<!--  	<a class="btn btn-mini" ng-click="logload(item.name)" target="_blank" ng-show="item.isreg||(item.islnk&&item.link_isreg)" title="下载"><i class="icon-download-alt"></i></button> -->
							<a class="btn btn-mini" href="{{curpath+'/'+item.name}}" target="_blank" ng-show="item.isreg||(item.islnk&&item.link_isreg)" title="下载"><i class="icon-download-alt"></i></button>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	</div>
	<div style="display:none" id="edit">
		<h4>正在查看：{{filepath}}</h4>
		<div style="margin:15px 0;height:30px;">
			<div class="pull-left">
				<button class="btn btn-small" ng-click="return2list()"><i class="icon-chevron-left"></i> 返回文件列表</button>
			</div>
            <div class="pull-right">
                <button class="btn btn-small" ng-click="cleanLog(filepath)"><i class="icon-remove"></i> 清空日志文件</button>
            </div>
		</div>
		<div id="editor"></div>
		<div style="margin:15px 0;height:30px;">
			<div class="pull-left">
				<button class="btn btn-small" ng-click="return2list()"><i class="icon-chevron-left"></i> 返回文件列表</button>
			</div>
            <div class="pull-right">
                <button class="btn btn-small" ng-click="cleanLog(filepath)"><i class="icon-remove"></i> 清空日志文件</button>
            </div>
            
		</div>
        
	</div>
</div>

<div id="newname" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>{{newname_title}}</h3>
  </div>
  <div class="modal-body">
	<form class="form-horizontal" onsubmit="return false">
		<div class="control-group">
			<label class="control-label">{{newname_label}}：</label>
			<div class="controls">
				<input type="text" ng-model="newname_name">
			</div>
		</div>
	</form>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
    <button class="btn btn-primary" onclick="$('#newname').modal('hide')" ng-click="newname()">确定</button>
  </div>
</div>

<div id="selector" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>{{selector_title}}</h3>
  </div>
  <div class="modal-body">
	<div selector></div>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
  </div>
</div>

<div id="confirm" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>{{confirm_title}}</h3>
  </div>
  <div class="modal-body" ng-bind-html-unsafe="confirm_body">
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true" ng-click="cancel()">取消</button>
    <button class="btn btn-primary" onclick="$('#confirm').modal('hide')" ng-click="confirm()">确定</button>
  </div>
</div>
